<?php

class FP_Image_Crop extends FP_Image
{
  public function __construct($pFile, $pX, $pY, $pWidth, $pHeight, $pDestination=null){

    $original = $this->create($pFile);

    $this->image = imagecreatetruecolor($pWidth, $pHeight);
    imagecopyresampled($this->image, $original, 0, 0, $pX, $pY, $pWidth, $pHeight, $pWidth, $pHeight);

    imagedestroy($original);

    if ($pDestination){
      $this->save($pDestination);
    }
  }
}

?>